package defpackage; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.os.RemoteException; import android.support.v4.util.SimpleArrayMap; import android.text.TextUtils; import cn.wps.moffice.OfficeApp; import cn.wps.note.base.NoteApp; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import defpackage.hxs; import defpackage.hxt; import defpackage.smd; import defpackage.smi; import defpackage.sng; import defpackage.stb; import defpackage.stg; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; /* renamed from: hxw reason: default package */ public class hxw extends hxt.a { private static final String TAG = hxw.class.getSimpleName(); private BroadcastReceiver dxx = new BroadcastReceiver() { /* class defpackage.hxw.AnonymousClass20 */ private void sync() { String str = null; String str2 = hxw.this.iYt == null ? null : hxw.this.iYt.id; if (hxw.this.iYt != null) { str = hxw.this.iYt.token; } if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str)) { try { hxw.this.c(str, str2, false, (hxu) new hxv()); hxw.this.d(str, str2, false, (hxu) new hxv()); } catch (RemoteException e) { e.printStackTrace(); } } } public final void onReceive(Context context, Intent intent) { String action = intent.getAction(); String unused = hxw.TAG; new StringBuilder("NoteServiceImpl BroadcastAction:").append(action); char c = 65535; switch (action.hashCode()) { case -1172645946: if (action.equals("android.net.conn.CONNECTIVITY_CHANGE")) { c = 2; break; } break; case 682553232: if (action.equals("cn.wps.moffice.note.BROAD_CAST_ENTER_BACK_STAGE")) { c = 0; break; } break; case 1930107998: if (action.equals("cn.wps.moffice.note.BROAD_CAST_ENTER_FRONT_STAGE")) { c = 1; break; } break; } switch (c) { case 0: sync(); return; case 1: sync(); String str = hxw.this.iYt == null ? null : hxw.this.iYt.token; if (!TextUtils.isEmpty(str)) { hxw.b(hxw.this, str); return; } return; case 2: if (snq.hu(hxw.this.mContext)) { String unused2 = hxw.TAG; sync(); return; } String unused3 = hxw.TAG; return; default: return; } } }; private hym<hyq<hwo>> iYA = new hym<hyq<hwo>>() { /* class defpackage.hxw.AnonymousClass21 */ private void eb(String str, String str2) { synchronized (hxw.this.iYf) { hws dv = hxw.this.iYg.dv(str, str2); if (dv != null) { dv.iVc = System.currentTimeMillis(); dv.iVd++; hxw.this.iYg.a(dv); } } } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hym public final /* synthetic */ void Z(hyq<hwo> hyq) { hyq<hwo> hyq2 = hyq; eb(hyq2.iZy.userId, hyq2.iZy.id); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hym public final /* synthetic */ void aa(hyq<hwo> hyq) { hyq<hwo> hyq2 = hyq; synchronized (hxw.this.iYf) { int i = hyq2.iZx.iVp; T t = hyq2.iZy; String str = t.id; String str2 = t.userId; hws dv = hxw.this.iYg.dv(str2, str); if (dv != null) { if (dv.iVp == i) { hxw.this.iYg.dD(str2, str); hxw.this.iYg.a((hwo) t); Intent intent = new Intent("cn.wps.moffice.note.noteservice.broadcast.UPLOAD_SUCCESS"); intent.setPackage(NoteApp.fdj().getPackageName()); intent.putExtra("cn.wps.note.noteservice.NOTE_ID", str); hxw.this.mContext.sendBroadcast(intent); } } } } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, int] */ @Override // defpackage.hym public final /* synthetic */ void b(hyq<hwo> hyq, int i) { hyq<hwo> hyq2 = hyq; eb(hyq2.iZy.userId, hyq2.iZy.id); } @Override // defpackage.hym public final hwv cmR() { return hxw.this.iYt; } @Override // defpackage.hym public final List<hyq<hwo>> cmW() { synchronized (hxw.this.iYf) { String str = hxw.this.iYt == null ? null : hxw.this.iYt.id; if (TextUtils.isEmpty(str)) { return null; } List<hws> Cm = hxw.this.iYg.Cm(str); if (Cm.isEmpty()) { return null; } ArrayList arrayList = new ArrayList(); for (hws hws : Cm) { String str2 = hws.gDU; hwo ds = hxw.this.iYg.ds(str, str2); if (ds == null) { hxw.this.iYg.dD(str, str2); } else { arrayList.add(new hyq(hws, ds)); } } return arrayList; } } }; private hym<hyq<hwp>> iYB = new hym<hyq<hwp>>() { /* class defpackage.hxw.AnonymousClass22 */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hym public final /* bridge */ /* synthetic */ void Z(hyq<hwp> hyq) { } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hym public final /* synthetic */ void aa(hyq<hwp> hyq) { hyq<hwp> hyq2 = hyq; synchronized (hxw.this.iYf) { int i = hyq2.iZx.iVp; T t = hyq2.iZy; String str = t.id; String str2 = t.userId; hws dw = hxw.this.iYg.dw(str2, str); if (dw != null) { if (dw.iVp == i) { hxw.this.iYg.dE(str2, str); hxw.this.iYg.a((hwp) t); Intent intent = new Intent("cn.wps.moffice.note.noteservice.broadcast.UPLOAD_SUCCESS"); intent.setPackage(NoteApp.fdj().getPackageName()); intent.putExtra("cn.wps.note.noteservice.NOTE_ID", str); hxw.this.mContext.sendBroadcast(intent); } } } } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, int] */ @Override // defpackage.hym public final /* synthetic */ void b(hyq<hwp> hyq, int i) { hyq<hwp> hyq2 = hyq; String str = hyq2.iZy.userId; String str2 = hyq2.iZy.id; synchronized (hxw.this.iYf) { hws dw = hxw.this.iYg.dw(str, str2); if (dw != null) { dw.iVc = System.currentTimeMillis(); dw.iVd++; hxw.this.iYg.b(dw); } } } @Override // defpackage.hym public final hwv cmR() { return hxw.this.iYt; } @Override // defpackage.hym public final List<hyq<hwp>> cmW() { synchronized (hxw.this.iYf) { String str = hxw.this.iYt == null ? null : hxw.this.iYt.id; if (TextUtils.isEmpty(str)) { return null; } List<hws> Cn = hxw.this.iYg.Cn(str); if (Cn.isEmpty()) { return null; } ArrayList arrayList = new ArrayList(); for (hws hws : Cn) { String str2 = hws.gDU; hwp dt = hxw.this.iYg.dt(str, str2); if (dt == null) { hxw.this.iYg.dE(str, str2); } else { arrayList.add(new hyq(hws, dt)); } } return arrayList; } } }; private hyo iYC = new hyo() { /* class defpackage.hxw.AnonymousClass23 */ @Override // defpackage.hyo public final void a(hwt hwt, int i) { String unused = hxw.TAG; new StringBuilder("onUploadDeleteError errorCode:").append(i); String str = hwt.userId; String str2 = hwt.gDU; synchronized (hxw.this.iYf) { hwt dx = hxw.this.iYg.dx(str, str2); if (dx != null) { dx.iVc = System.currentTimeMillis(); dx.iVd++; hxw.this.iYg.a(dx); } } } @Override // defpackage.hyo public final void b(hwt hwt) { synchronized (hxw.this.iYf) { hxw.this.iYg.dF(hwt.userId, hwt.gDU); } } @Override // defpackage.hyo public final List<hwt> cmX() { List<hwt> list = null; synchronized (hxw.this.iYf) { String str = hxw.this.iYt == null ? null : hxw.this.iYt.id; if (str != null) { list = hxw.this.iYg.Co(str); } } return list; } @Override // defpackage.hyo public final String getToken() { if (hxw.this.iYt == null) { return null; } return hxw.this.iYt.token; } }; private hyj iYD = new hyj() { /* class defpackage.hxw.AnonymousClass24 */ @Override // defpackage.hyj public final List<hwm> cmY() { String str = hxw.this.iYt == null ? null : hxw.this.iYt.id; if (str == null) { return null; } return hxw.this.iYj.Cf(str); } @Override // defpackage.hyj public final void f(hwm hwm) { if (!hxw.this.iYj.c(hwm)) { hxw.this.iYr.cmZ(); } } @Override // defpackage.hyj public final void g(hwm hwm) { hwm.iVf = 0; hxw.this.iYj.a(hwm); } @Override // defpackage.hyj public final String getToken() { if (hxw.this.iYt == null) { return null; } return hxw.this.iYt.token; } }; private hxy iYE = new hxy() { /* class defpackage.hxw.AnonymousClass25 */ @Override // defpackage.hxy public final String getToken() { if (hxw.this.iYt == null) { return null; } return hxw.this.iYt.token; } @Override // defpackage.hxy public final String getUserId() { if (hxw.this.iYt == null) { return null; } return hxw.this.iYt.id; } }; private Object iYf = new Object(); private hxe iYg; private hxk iYh; private hxa iYi; private hxc iYj; private hxi iYk; private hys iYl; private hyc iYm; private hyf iYn; private hyl iYo; private hyl iYp; private hyl iYq; private hyi iYr; private hxx iYs; private volatile hwv iYt; private volatile String iYu; private volatile boolean iYv = false; private SimpleArrayMap<String, Object[]> iYw = new SimpleArrayMap<>(); private Thread iYx = null; private hyd iYy = new hyd() { /* class defpackage.hxw.AnonymousClass1 */ private void ea(String str, String str2) { synchronized (hxw.this.iYf) { hwr du = hxw.this.iYg.du(str, str2); if (du != null) { du.iVc = System.currentTimeMillis(); du.iVd++; hxw.this.iYg.a(du); } } } @Override // defpackage.hyd public final boolean CB(String str) { return !TextUtils.equals(hxw.this.iYu, str); } @Override // defpackage.hyd public final void b(hwr hwr) { synchronized (hxw.this.iYf) { String str = hwr.iVg.userId; String str2 = hwr.iVg.id; hwr du = hxw.this.iYg.du(str, str2); if (du != null) { int i = du.iVn; int i2 = du.iVo; if (i == hwr.iVn && i2 == hwr.iVo) { if (i != 0) { hxw.this.iYg.a(hwr.iVg); } if (i2 != 0) { hxw.this.iYg.a(hwr.iVh); } else if (hxw.this.iYg.dt(str, str2) == null) { hxw.this.iYg.a(hwr.iVh); } if (hwr.iVh.iVk == 0) { hxw.this.iYl.CG(hwr.iVg.id); } else { hxw.this.iYl.a(str2, hwr.iVh.iVk, hwr.iVh.iVl); } hxw.this.iYg.dC(str, hwr.iVg.id); Intent intent = new Intent("cn.wps.moffice.note.noteservice.broadcast.SYNC_SUCCESS"); intent.setPackage(NoteApp.fdj().getPackageName()); intent.putExtra("cn.wps.note.noteservice.NOTE_ID", hwr.iVg.id); hxw.this.mContext.sendBroadcast(intent); } } } } @Override // defpackage.hyd public final void b(String str, Iterator<String> it) { synchronized (hxw.this.iYf) { hxw.this.iYg.a(str, it); } } @Override // defpackage.hyd public final List<hwr> cmQ() { List<hwr> list = null; synchronized (hxw.this.iYf) { String str = hxw.this.iYt == null ? null : hxw.this.iYt.id; if (str != null) { list = hxw.this.iYg.Cl(str); } } return list; } @Override // defpackage.hyd public final hwv cmR() { return hxw.this.iYt; } @Override // defpackage.hyd public final void cmS() { Intent intent = new Intent("cn.wps.moffice.note.noteservice.broadcast.SYNC_START"); intent.setPackage(NoteApp.fdj().getPackageName()); hxw.this.mContext.sendBroadcast(intent); } @Override // defpackage.hyd public final void cmT() { Intent intent = new Intent("cn.wps.moffice.note.noteservice.broadcast.SYNC_OVER"); intent.setPackage(NoteApp.fdj().getPackageName()); hxw.this.mContext.sendBroadcast(intent); if (hxw.this.iYv) { hxw.this.iYv = false; synchronized (hxw.this.iYf) { if (hxw.this.iYt != null) { for (hwn hwn : hxw.this.iYg.Cj(hxw.this.iYt.id)) { hwo hwo = hwn.iVg; hwp hwp = hwn.iVh; hxw.this.iYl.a(hwo.id, hwp.iVk, hwp.iVl); } } } } } @Override // defpackage.hyd public final void dY(String str, String str2) { ea(str, str2); } @Override // defpackage.hyd public final void dZ(String str, String str2) { ea(str, str2); } }; private hyg iYz = new hyg() { /* class defpackage.hxw.AnonymousClass12 */ @Override // defpackage.hyg public final void CC(String str) { hxw.this.iYi.Cd(str); } @Override // defpackage.hyg public final void CD(String str) { hxw.this.iYi.Cd(str); } @Override // defpackage.hyg public final void CE(String str) { hwl Cb = hxw.this.iYi.Cb(str); if (Cb != null) { Cb.iVc = System.currentTimeMillis(); Cb.iVd++; hxw.this.iYi.a(Cb); } } @Override // defpackage.hyg public final List<hwl> cmV() { String str = hxw.this.iYt == null ? null : hxw.this.iYt.id; if (str == null) { return null; } return hxw.this.iYi.Cc(str); } @Override // defpackage.hyg public final String getToken() { if (hxw.this.iYt == null) { return null; } return hxw.this.iYt.token; } @Override // defpackage.hyg public final String getUserId() { if (hxw.this.iYt == null) { return null; } return hxw.this.iYt.id; } }; private Context mContext = NoteApp.fdj(); public hxw() { Cz(getCountry()); this.iYg = (hxe) hwy.cmt().get("NOTE"); this.iYh = (hxk) hwy.cmt().get("USER"); this.iYi = (hxa) hwy.cmt().get("ATTACHMENT"); this.iYj = (hxc) hwy.cmt().get("GROUP"); this.iYk = (hxi) hwy.cmt().get("THEME"); this.iYl = hys.iZC; this.iYm = new hye(this.iYy); this.iYn = new hyh(this.iYz); this.iYo = new hyn(this.iYA); this.iYp = new hyr(this.iYB); this.iYq = new hyp(this.iYC); this.iYr = new hyk(this.iYD); this.iYs = new hxz(this.iYE); this.iYt = this.iYh.cmv(); if (this.iYt != null) { String str = this.iYt.id; new AsyncTask<String, Void, Void>() { /* class defpackage.hxw.AnonymousClass18 */ /* access modifiers changed from: private */ /* renamed from: z */ public Void doInBackground(String... strArr) { String str = strArr[0]; long currentTimeMillis = System.currentTimeMillis(); synchronized (hxw.this.iYf) { for (hwp hwp : hxw.this.iYg.Ck(str)) { String str2 = hwp.id; hwo ds = hxw.this.iYg.ds(str, str2); if (Math.abs(currentTimeMillis - (ds == null ? hwp.czI : Math.max(ds.czI, hwp.czI))) > 2592000000L) { hxw.this.iYg.dB(str, str2); if (ds != null) { hxw.this.a((hxw) str, (String) ds); } } } } List<hwm> Cg = hxw.this.iYj.Cg(str); ArrayList arrayList = new ArrayList(); for (hwm hwm : Cg) { if (Math.abs(currentTimeMillis - hwm.czI) > 2592000000L) { arrayList.add(hwm.id); } } if (arrayList.size() == 0) { return null; } hxw.this.iYj.j(str, arrayList); return null; } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, str); qb(true); } IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction("cn.wps.moffice.note.BROAD_CAST_ENTER_BACK_STAGE"); intentFilter.addAction("cn.wps.moffice.note.BROAD_CAST_ENTER_FRONT_STAGE"); intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE"); this.mContext.registerReceiver(this.dxx, intentFilter); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void CA(String str) { this.iYh.Cs(str); this.iYt = null; sng.agF(sng.a.uin).a(snf.USER_SESSION); sng.agF(sng.a.uin).a(snf.LAST_SYNC_NOTE_TIME); sng.agF(sng.a.uin).a(snf.LAST_SYNC_GROUP_TIME); sng.agF(sng.a.uin).a(snf.COUNTRY); synchronized (this.iYf) { for (hwn hwn : this.iYg.Cj(str)) { this.iYl.CG(hwn.iVg.id); } } Intent intent = new Intent("cn.wps.moffice.note.noteservice.broadcast.LOGOUT"); intent.setPackage(NoteApp.fdj().getPackageName()); this.mContext.sendBroadcast(intent); } private void Cz(String str) { hxr hxr = new hxr(); boolean equals = str.equals("cn"); hxr.iXQ = equals ? "https://note-api.wps.cn" : "https://note-api.wps.com"; hxr.iXR = equals ? "https://account.wps.cn" : "https://account.wps.com"; hxr.iXS = equals ? "https://note-api.wps.cn" : "https://note-api.wps.com"; Context context = this.mContext; File externalCacheDir = context.getExternalCacheDir(); if (externalCacheDir == null) { externalCacheDir = new File(Environment.getExternalStorageDirectory().getPath() + ("/Android/data/" + context.getPackageName() + "/cache")); } if (externalCacheDir.exists() && externalCacheDir.isFile()) { externalCacheDir.delete(); } if (!externalCacheDir.exists()) { externalCacheDir.mkdirs(); } File file = new File(externalCacheDir, "networkLog"); if (file.exists() && file.isFile()) { file.delete(); } if (!file.exists()) { file.mkdirs(); } hxr.iXP = file.getPath(); hxr.iXT = OfficeApp.arx().arB(); hxr.appVersion = OfficeApp.arx().cqM; hxr.iXU = snl.getDeviceId(); hxr.deviceName = snl.getDeviceName(); hxr.iXV = "android"; hxr.iXW = snl.fdG(); hxr.iXX = snl.fdF(); hxr.iXY = snl.fdG(); hxr.iXZ = false; hxs.a(hxr); } /* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: hxw */ /* JADX WARN: Multi-variable type inference failed */ /* access modifiers changed from: private */ /* access modifiers changed from: public */ private <T> void a(hxu hxu, T t, int i) { if (t != null) { try { if (!(t instanceof Void)) { hxu.x(f("cn.wps.note.noteservice.CODE_OK", (Object) t)); } } catch (RemoteException e) { new StringBuilder("handleCallback e:").append(e.getMessage()); return; } } if (i == 0) { hxu.onSuccess(); return; } hxu.m(f("cn.wps.note.noteservice.CODE_ERROR", Integer.valueOf(i))); switch (i) { case -2010: if (this.iYt != null) { Intent intent = new Intent("cn.wps.moffice.note.noteservice.broadcast.USER_NOT_LOGIN"); intent.setPackage(NoteApp.fdj().getPackageName()); this.mContext.sendBroadcast(intent); return; } return; default: return; } } static /* synthetic */ void a(hxw hxw, sst sst, hxu hxu) { hxw.a(hxu, smi.a.fZ(sst.mUserId, getCountry()), 0); } static /* synthetic */ void a(hxw hxw, final sst sst, final String str, final hxu hxu) { hxs.b(sst.kZm, new hxs.b<ssq>() { /* class defpackage.hxw.AnonymousClass6 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(ssq ssq) { ssq ssq2 = ssq; hxw.this.f(str, sst.kZm, sst.mUserId, ssq2.usw, ssq2.usr); hxw.this.a((hxw) hxu, (hxu) null, (Object) 0); } }); } static /* synthetic */ void a(hxw hxw, sty sty, hxu hxu) { ArrayList arrayList = new ArrayList(); List<stx> list = sty.utE; if (list != null && !list.isEmpty()) { for (stx stx : list) { String str = stx.resourceUrl; if (!TextUtils.isEmpty(str)) { arrayList.add(str); } } } hxw.a(hxu, arrayList, 0); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void a(String str, hwo hwo) { if (hwo != null) { hza.cnp().c(hwo); snn.aR(ssk.J(this.mContext, str, hwo.id)); if (!TextUtils.isEmpty(hwo.iVi)) { new File(ssk.hY(this.mContext), hwo.iVi).delete(); } } } static /* synthetic */ boolean a(hxw hxw, hwu hwu) { return !TextUtils.isEmpty(hwu.id) && !TextUtils.isEmpty(hwu.fws) && !TextUtils.isEmpty(hwu.iVs) && !TextUtils.isEmpty(hwu.iVt) && !TextUtils.isEmpty(hwu.iVu) && !TextUtils.isEmpty(hwu.iVv) && !TextUtils.isEmpty(hwu.iVw) && !TextUtils.isEmpty(hwu.iVx) && !TextUtils.isEmpty(hwu.iVy) && !TextUtils.isEmpty(hwu.iVz) && !TextUtils.isEmpty(hwu.iVA) && !TextUtils.isEmpty(hwu.iVB) && !TextUtils.isEmpty(hwu.iVC) && !TextUtils.isEmpty(hwu.iVD) && !TextUtils.isEmpty(hwu.iVE) && !TextUtils.isEmpty(hwu.iVM) && !TextUtils.isEmpty(hwu.iVN) && !TextUtils.isEmpty(hwu.iVO) && !TextUtils.isEmpty(hwu.iVP) && !TextUtils.isEmpty(hwu.iVQ) && hwu.iVW != null && hwu.iVW.size() >= 3 && !TextUtils.isEmpty(hwu.url) && !TextUtils.isEmpty(hwu.md5); } private void ab(String str, String str2, String str3) { hwp dt = this.iYg.dt(str, str2); if (dt == null) { dt = new hwp(); dt.id = str2; dt.userId = str; } dt.groupId = str3; if (!TextUtils.isEmpty(dt.groupId) && 0 != dt.iVk) { dt.iVl = 0; dt.iVk = 0; this.iYl.CG(dt.id); } dt.czI = System.currentTimeMillis(); this.iYg.a(dt); hws dw = this.iYg.dw(str, str2); if (dw == null) { dw = new hws(); dw.gDU = str2; dw.userId = str; dw.iVp = -1; } dw.iVp++; dw.iVc = 0; dw.iVd = 0; this.iYg.b(dw); } static /* synthetic */ void b(hxw hxw, String str) { hxs.d(str, new hxs.b<ssr>() { /* class defpackage.hxw.AnonymousClass19 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { if (hxw.this.iYt != null && -2010 == i) { Intent intent = new Intent("cn.wps.moffice.note.noteservice.broadcast.USER_NOT_LOGIN"); intent.setPackage(NoteApp.fdj().getPackageName()); hxw.this.mContext.sendBroadcast(intent); } } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* bridge */ /* synthetic */ void y(ssr ssr) { } }); } private void dX(String str, String str2) { hwt hwt = new hwt(); hwt.gDU = str2; hwt.userId = str; this.iYg.a(hwt); hwp dt = this.iYg.dt(str, str2); if (dt == null) { dt = new hwp(); dt.id = str2; dt.userId = str; } dt.iVe = 1; dt.czI = System.currentTimeMillis(); this.iYg.a(dt); this.iYg.dC(str, str2); this.iYg.dD(str, str2); this.iYg.dE(str, str2); hwo ds = this.iYg.ds(str, str2); if (ds != null) { List<String> Se = sow.Se(ssk.J(this.mContext, str, str2).getAbsolutePath()); if (!(Se == null || Se.size() == 0)) { this.iYi.cF(Se); } hza.cnp().c(ds); } } private <T> Bundle f(String str, T t) { Bundle bundle = new Bundle(); bundle.putString("cn.wps.note.noteservice.KEY_STATUS_CODE", str); if (t != null && !(t instanceof Void)) { bundle.putString("cn.wps.note.noteservice.KEY_RESULT", sno.getGson().toJson((Object) t)); } if (!TextUtils.isEmpty(null)) { bundle.putString("cn.wps.note.noteservice.KEY_RESULT_ERR_MSG", null); } return bundle; } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void f(String str, String str2, String str3, String str4, String str5) { sng.agF(sng.a.uin).a(snf.COUNTRY, str); String fZ = smi.a.fZ(str3, str); hwv hwv = new hwv(); hwv.id = fZ; hwv.token = str2; hwv.ecE = str4; hwv.iWc = str5; this.iYh.a(hwv); this.iYv = true; synchronized (this.iYf) { List<hwn> Ch = this.iYg.Ch(null); if (!(Ch == null || Ch.size() == 0)) { ArrayList arrayList = new ArrayList(); ArrayList arrayList2 = new ArrayList(); for (hwn hwn : Ch) { hwo hwo = hwn.iVg; hwo.userId = fZ; hwn.iVh.userId = fZ; String str6 = hwo.id; arrayList.add(str6); ssk.J(this.mContext, null, str6).renameTo(ssk.J(this.mContext, fZ, str6)); snn.aR(ssk.J(this.mContext, null, str6)); hws dv = this.iYg.dv(null, str6); if (dv != null) { dv.userId = fZ; dv.iVc = 0; dv.iVd = 0; this.iYg.dD(null, str6); this.iYg.a(dv); } hws dw = this.iYg.dw(null, str6); if (dw != null) { dw.userId = fZ; dw.iVc = 0; dw.iVd = 0; this.iYg.dE(null, str6); this.iYg.b(dw); } List<String[]> Sf = sow.Sf(ssk.J(this.mContext, fZ, str6).getAbsolutePath()); if (!(Sf == null || Sf.size() == 0)) { for (String[] strArr : Sf) { hwl hwl = new hwl(); hwl.path = strArr[0]; hwl.iVb = strArr[1]; hwl.userId = fZ; arrayList2.add(hwl); } } if (!TextUtils.isEmpty(hwo.iVi)) { File file = new File(ssk.hY(this.mContext), hwo.iVi); if (file.exists()) { hwl hwl2 = new hwl(); hwl2.path = file.getAbsolutePath(); hwl2.iVb = hwo.iVi; hwl2.userId = fZ; arrayList2.add(hwl2); } } } this.iYg.n(null, arrayList); this.iYg.cH(Ch); if (arrayList2.size() != 0) { this.iYi.cE(arrayList2); } } } List<hwm> Ce = this.iYj.Ce(null); ArrayList arrayList3 = new ArrayList(); for (hwm hwm : Ce) { hwm.userId = fZ; arrayList3.add(hwm.id); } if (Ce.size() != 0) { this.iYj.j(null, arrayList3); this.iYj.cG(Ce); } qb(false); sng.agF(sng.a.uin).a(snf.USER_SESSION, sno.getGson().toJson(hwv)); this.iYt = hwv; Intent intent = new Intent("cn.wps.moffice.note.noteservice.broadcast.LOGIN_SUCCESS"); intent.setPackage(NoteApp.fdj().getPackageName()); this.mContext.sendBroadcast(intent); } private static String getCountry() { return sng.agF(sng.a.uin).b(snf.COUNTRY, "cn"); } private void h(String str, String str2, int i) { hwp dt = this.iYg.dt(str, str2); if (dt == null) { dt = new hwp(); dt.id = str2; dt.userId = str; } dt.iVj = i; dt.czI = System.currentTimeMillis(); this.iYg.a(dt); hws dw = this.iYg.dw(str, str2); if (dw == null) { dw = new hws(); dw.gDU = str2; dw.userId = str; dw.iVp = -1; } dw.iVp++; dw.iVc = 0; dw.iVd = 0; this.iYg.b(dw); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void qb(boolean z) { if (this.iYt != null) { if (z) { this.iYm.cnf(); } this.iYo.cmZ(); this.iYp.cmZ(); this.iYq.cmZ(); this.iYn.cmZ(); this.iYr.cmZ(); this.iYs.cmZ(); } } @Override // defpackage.hxt public final String Cx(String str) throws RemoteException { hwu Cr = this.iYk.Cr(str); if (Cr == null) { return null; } return sno.getGson().toJson(Cr); } @Override // defpackage.hxt public final void Cy(String str) { CA(str); } @Override // defpackage.hxt public final void a(final hxu hxu) throws RemoteException { hxs.b(new hxs.b<sty>() { /* class defpackage.hxw.AnonymousClass9 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(sty sty) { ArrayList arrayList = new ArrayList(); List<stx> list = sty.utE; if (list != null && !list.isEmpty()) { for (stx stx : list) { stz stz = stx.utD; if (stz != null) { if (sno.uir == null) { sno.uir = new GsonBuilder().create(); } hwu hwu = (hwu) sno.instance(sno.uir.toJson(stz), hwu.class); if (hwu != null && hxw.a(hxw.this, hwu)) { arrayList.add(hwu); } } } } hxw.this.a((hxw) hxu, (hxu) arrayList, (Object) 0); } }); } @Override // defpackage.hxt public final void a(String str, final hxu hxu) throws RemoteException { hxs.a(str, new hxs.b<sst>() { /* class defpackage.hxw.AnonymousClass27 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(sst sst) { hxw.a(hxw.this, sst, hxu); } }); } @Override // defpackage.hxt public final void a(String str, String str2, int i, hxu hxu) throws RemoteException { synchronized (this.iYf) { h(str, str2, i); } qb(true); a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final void a(String str, String str2, long j, int i, hxu hxu) throws RemoteException { synchronized (this.iYf) { hwp dt = this.iYg.dt(str, str2); if (dt == null) { dt = new hwp(); dt.id = str2; dt.userId = str; } dt.iVk = j; dt.iVl = i; if (0 != dt.iVk && !TextUtils.isEmpty(dt.groupId)) { dt.groupId = null; } dt.czI = System.currentTimeMillis(); this.iYg.a(dt); hws dw = this.iYg.dw(str, str2); if (dw == null) { dw = new hws(); dw.gDU = str2; dw.userId = str; dw.iVp = -1; } dw.iVp++; dw.iVc = 0; dw.iVd = 0; this.iYg.b(dw); } if (0 == j) { this.iYl.CG(str2); } else { this.iYl.a(str2, j, i); } qb(true); a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final void a(String str, String str2, final hxu hxu) throws RemoteException { hxs.a(str, str2, new hxs.b<sst>() { /* class defpackage.hxw.AnonymousClass26 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(sst sst) { hxw.a(hxw.this, sst, hxu); } }); } @Override // defpackage.hxt public final void a(String str, String str2, final String str3, final hxu hxu) throws RemoteException { Cz(str3); hxs.a(str, str2, new hxs.b<sst>() { /* class defpackage.hxw.AnonymousClass3 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(sst sst) { hxw.a(hxw.this, sst, str3, hxu); } }); } @Override // defpackage.hxt public final void a(String str, String str2, String str3, String str4, final hxu hxu) throws RemoteException { hxs.a(str, str2, str3, str4, new hxs.b<Void>() { /* class defpackage.hxw.AnonymousClass15 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(Void r5) { hxw.this.a((hxw) hxu, (hxu) null, (Object) 0); } }); } @Override // defpackage.hxt public final void a(String str, String str2, String str3, String str4, String str5, boolean z, final hxu hxu) { hxs.a(str, str2, str3, str4, str5, z, new hxs.b<sst>() { /* class defpackage.hxw.AnonymousClass2 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(sst sst) { hxw.a(hxw.this, sst, hxu); } }); } @Override // defpackage.hxt public final void a(String str, String str2, String str3, String str4, String str5, boolean z, final String str6, final hxu hxu) { Cz(str6); hxs.a(str, str2, str3, str4, str5, z, new hxs.b<sst>() { /* class defpackage.hxw.AnonymousClass5 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(sst sst) { hxw.a(hxw.this, sst, str6, hxu); } }); } @Override // defpackage.hxt public final void a(String str, String str2, String str3, boolean z, hxu hxu) throws RemoteException { hwl hwl = new hwl(); hwl.iVb = str2; hwl.path = str3; hwl.userId = str; hwl.iVc = 0; hwl.iVd = 0; this.iYi.a(hwl); if (z) { qb(true); } a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final void a(String str, final String str2, boolean z, final hxu hxu) throws RemoteException { if (!z) { CA(str2); a(hxu, (Object) null, 0); return; } hxs.c(str, new hxs.b<Void>() { /* class defpackage.hxw.AnonymousClass7 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(Void r5) { hxw.this.CA(str2); hxw.this.a((hxw) hxu, (hxu) null, (Object) 0); } }); } @Override // defpackage.hxt public final void a(String str, List<String> list, int i, hxu hxu) throws RemoteException { synchronized (this.iYf) { for (String str2 : list) { h(str, str2, i); } } qb(true); a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final void a(String str, List<String> list, hxu hxu) throws RemoteException { List<hwn> l; synchronized (this.iYf) { l = this.iYg.l(str, list); } a(hxu, l, 0); } @Override // defpackage.hxt public final void a(String str, List<String> list, String str2, hxu hxu) throws RemoteException { synchronized (this.iYf) { for (String str3 : list) { ab(str, str3, str2); } } qb(true); a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final boolean arU() throws RemoteException { return this.iYt != null; } @Override // defpackage.hxt public final void b(final hxu hxu) throws RemoteException { hxs.a(new hxs.b<sty>() { /* class defpackage.hxw.AnonymousClass10 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(sty sty) { hxw.a(hxw.this, sty, hxu); } }); } @Override // defpackage.hxt public final void b(String str, hxu hxu) throws RemoteException { if (TextUtils.equals(str, this.iYm.cng())) { a(hxu, (Object) null, 1002); return; } this.iYu = str; a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final void b(String str, String str2, int i, hxu hxu) throws RemoteException { if (i == 1) { hwu dR = this.iYk.dR(str, str2); sng.agF(sng.a.uin).bU(smd.a.RR(str), dR == null ? null : sno.getGson().toJson(dR)); } else { this.iYk.dS(str, str2); sng.agF(sng.a.uin).remove(smd.a.RR(str)); } Intent intent = new Intent("cn.wps.moffice.note.base.broadcast.THEME_SWITCHING"); intent.setPackage(NoteApp.fdj().getPackageName()); this.mContext.sendBroadcast(intent); a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final void b(String str, final String str2, final hxu hxu) throws RemoteException { Cz(str2); hxs.a(str, new hxs.b<sst>() { /* class defpackage.hxw.AnonymousClass4 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(sst sst) { hxw.a(hxw.this, sst, str2, hxu); } }); } @Override // defpackage.hxt public final void b(final String str, final String str2, final String str3, final hxu hxu) throws RemoteException { hws dv; synchronized (this.iYf) { dv = this.iYg.dv(str2, str3); } if (dv == null) { a(hxu, (Object) null, 0); } else { hxs.b(str, str3, new hxs.b<sta>() { /* class defpackage.hxw.AnonymousClass8 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(sta sta) { int dz; sta sta2 = sta; if (TextUtils.equals(hxw.this.iYo.cnh(), str3)) { hxw.this.a((hxw) hxu, (hxu) null, (Object) 0); return; } final int i = sta2.usQ; final long j = sta2.usR; synchronized (hxw.this.iYf) { dz = hxw.this.iYg.dz(str2, str3); } if (i == dz) { hxw.this.a((hxw) hxu, (hxu) null, (Object) 0); return; } HashMap hashMap = new HashMap(); final String Sq = ssk.Sq(ssk.I(OfficeApp.arx(), str2, str3).getAbsolutePath()); if (!new File(Sq).getParentFile().exists()) { new File(Sq).getParentFile().mkdirs(); } final String str = Sq + ".temp" + System.currentTimeMillis(); hashMap.put(str3, str); hxs.a(str, hashMap, new hxs.b<ssz>() { /* class defpackage.hxw.AnonymousClass8.AnonymousClass1 */ private void cmU() { new File(str).delete(); } @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); cmU(); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(ssz ssz) { if (new File(str).renameTo(new File(Sq))) { Intent intent = new Intent("cn.wps.moffice.note.noteservice.broadcast.CONFLICT_NOTE"); intent.setPackage(NoteApp.fdj().getPackageName()); intent.putExtra("cn.wps.note.noteservice.NOTE_CONFLICT_PATH", Sq); hxw.this.mContext.sendBroadcast(intent); hxw.this.iYw.put(str3, new Object[]{Integer.valueOf(i), Long.valueOf(j)}); hxw.this.a((hxw) hxu, (hxu) null, (Object) 0); } else { hxw.this.a((hxw) hxu, (hxu) null, (Object) -1); } cmU(); } }); } }); } } @Override // defpackage.hxt public final void b(String str, String str2, String str3, String str4, final hxu hxu) throws RemoteException { hxs.b(str, str2, str3, str4, new hxs.b<Void>() { /* class defpackage.hxw.AnonymousClass16 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } @Override // defpackage.hxs.b, defpackage.hxs.a public final void onProgress(long j, long j2) { try { hxu.onProgress(j, j2); } catch (RemoteException e) { e.printStackTrace(); } } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(Void r5) { hxw.this.a((hxw) hxu, (hxu) null, (Object) 0); } }); } @Override // defpackage.hxt public final void b(String str, String str2, boolean z, hxu hxu) throws RemoteException { hws hws; synchronized (this.iYf) { hwo hwo = (hwo) sno.instance(str2, hwo.class); hwo.version = this.iYg.dz(str, hwo.id); hwo.czI = System.currentTimeMillis(); hwo.userId = str; this.iYg.a(hwo); hwp dt = this.iYg.dt(str, hwo.id); if (dt == null) { hwp hwp = new hwp(); hwp.id = hwo.id; hwp.userId = str; this.iYg.a(hwp); } else if (1 == dt.iVe) { dt.iVe = 0; this.iYg.a(dt); } hws dv = this.iYg.dv(str, hwo.id); if (dv == null) { hws hws2 = new hws(); hws2.gDU = hwo.id; hws2.userId = str; hws2.iVp = -1; hws = hws2; } else { hws = dv; } hws.iVp++; hws.iVc = 0; hws.iVd = 0; this.iYg.a(hws); } if (z) { qb(true); } a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final void b(String str, List<String> list, hxu hxu) throws RemoteException { boolean m; synchronized (this.iYf) { m = this.iYg.m(str, list); } a(hxu, Boolean.valueOf(m), 0); } @Override // defpackage.hxt public final void c(String str, hxu hxu) throws RemoteException { this.iYu = null; a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final void c(String str, String str2, hxu hxu) throws RemoteException { boolean z; hwo hwo = (hwo) sno.instance(str2, hwo.class); if (this.iYw.containsKey(hwo.id)) { Object[] remove = this.iYw.remove(hwo.id); hwo.version = ((Integer) remove[0]).intValue(); hwo.czI = ((Long) remove[1]).longValue(); hwo.userId = str; synchronized (this.iYf) { this.iYg.a(hwo); this.iYg.dD(str, hwo.id); } z = true; } else { z = false; } if (z) { a(hxu, (Object) null, 0); } else { a(hxu, (Object) null, -1); } } @Override // defpackage.hxt public final void c(String str, String str2, String str3, hxu hxu) throws RemoteException { synchronized (this.iYf) { ab(str, str2, str3); } qb(true); a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final void c(String str, final String str2, boolean z, final hxu hxu) throws RemoteException { long b = sng.agF(sng.a.uin).b(snf.LAST_SYNC_NOTE_TIME, 0); long currentTimeMillis = System.currentTimeMillis(); if (z || Math.abs(currentTimeMillis - b) > 86400000) { b = 0; } hxs.a(str, b, new hxs.b<stg>() { /* class defpackage.hxw.AnonymousClass13 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(stg stg) { boolean z; hwo hwo; stg stg2 = stg; List<stg.a> list = stg2.uta; synchronized (hxw.this.iYf) { if (list != null) { if (list.size() != 0) { boolean z2 = false; for (stg.a aVar : list) { if (aVar.usU == 0) { hwn dr = hxw.this.iYg.dr(str2, aVar.gDU); if (dr != null) { if (hxw.this.iYg.dv(str2, aVar.gDU) != null) { z2 = true; } else if (hxw.this.iYg.dw(str2, aVar.gDU) != null) { z2 = true; } else { hwp hwp = dr.iVh; if (hwp != null && hwp.iVe == 0) { hwp.iVe = 1; hxw.this.iYg.a(hwp); if (hwp.iVk != 0) { hxw.this.iYl.CG(hwp.id); } hxw.this.iYg.dC(str2, aVar.gDU); List<String> Se = sow.Se(ssk.J(hxw.this.mContext, str2, dr.iVg.id).getAbsolutePath()); if (!(Se == null || Se.size() == 0)) { hxw.this.iYi.cF(Se); } Intent intent = new Intent("cn.wps.moffice.note.noteservice.broadcast.NOTE_DELETED"); intent.setPackage(NoteApp.fdj().getPackageName()); intent.putExtra("cn.wps.note.noteservice.NOTE_ID", aVar.gDU); hxw.this.mContext.sendBroadcast(intent); } } } } else if (hxw.this.iYg.dv(str2, aVar.gDU) != null) { z2 = true; } else { hwr du = hxw.this.iYg.du(str2, aVar.gDU); hwr hwr = du == null ? new hwr() : du; if (aVar.usQ != 0) { hwr.iVn = aVar.usQ; } if (aVar.usX != 0) { hwr.iVo = aVar.usX; } hwo ds = hxw.this.iYg.ds(str2, aVar.gDU); if (ds == null) { hwo hwo2 = new hwo(); hwo2.id = aVar.gDU; hwo2.userId = str2; hwo = hwo2; } else { hwo = ds; } hwp dt = hxw.this.iYg.dt(str2, aVar.gDU); if (dt == null) { dt = new hwp(); dt.id = aVar.gDU; dt.userId = str2; } if (!((aVar.usQ == 0 || hwo.version == aVar.usQ) && (aVar.usX == 0 || dt.version == aVar.usX))) { if (dt.iVe == 1) { dt.iVe = 0; hxw.this.iYg.a(dt); hxw.this.iYg.dF(str2, aVar.gDU); } hwr.iVg = hwo; hwr.iVh = dt; hxw.this.iYg.a(hwr); } } } z = z2; } } z = false; } hxw.this.qb(true); if (!z) { sng.agF(sng.a.uin).a(snf.LAST_SYNC_NOTE_TIME, stg2.cwd); } hxw.this.a((hxw) hxu, (hxu) null, (Object) 0); } }); } @Override // defpackage.hxt public final void c(String str, List<String> list, hxu hxu) throws RemoteException { List<hwo> k; if (TextUtils.isEmpty(str)) { synchronized (this.iYf) { k = this.iYg.k(str, list); this.iYg.n(str, list); this.iYg.o(str, list); this.iYg.p(str, list); } for (hwo hwo : k) { this.iYl.CG(hwo.id); a((String) null, hwo); } } else { synchronized (this.iYf) { for (String str2 : list) { dX(str, str2); } } for (String str3 : list) { this.iYl.CG(str3); } qb(true); } a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final String cmO() throws RemoteException { if (this.iYt == null) { return null; } return sno.getGson().toJson(this.iYt); } @Override // defpackage.hxt public final void cmP() throws RemoteException { synchronized (this) { if (this.iYx == null || !this.iYx.isAlive()) { this.iYx = new Thread() { /* class defpackage.hxw.AnonymousClass17 */ public final void run() { hxs.cmN(); } }; this.iYx.start(); } } } @Override // defpackage.hxt public final void d(String str, hxu hxu) throws RemoteException { List<hwn> Ch; synchronized (this.iYf) { Ch = this.iYg.Ch(str); } a(hxu, Ch, 0); } @Override // defpackage.hxt public final void d(String str, String str2, hxu hxu) throws RemoteException { int dy; synchronized (this.iYf) { dy = this.iYg.dy(str, str2); } a(hxu, Integer.valueOf(dy), 0); } @Override // defpackage.hxt public final void d(String str, String str2, String str3, hxu hxu) throws RemoteException { synchronized (this.iYf) { hwo ds = this.iYg.ds(str, str2); if (ds != null) { ds.iVi = str3; this.iYg.a(ds); } } a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final void d(String str, final String str2, boolean z, final hxu hxu) throws RemoteException { long b = sng.agF(sng.a.uin).b(snf.LAST_SYNC_GROUP_TIME, 0); long currentTimeMillis = System.currentTimeMillis(); if (z || Math.abs(currentTimeMillis - b) > 86400000) { b = 0; } hxs.b(str, b, new hxs.b<stb>() { /* class defpackage.hxw.AnonymousClass14 */ @Override // defpackage.hxs.b, defpackage.hxs.a public final void Bd(int i) { hxw.this.a((hxw) hxu, (hxu) null, (Object) i); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // defpackage.hxs.b, defpackage.hxs.a public final /* synthetic */ void y(stb stb) { stb stb2 = stb; List<stb.a> list = stb2.usT; if (!(list == null || list.size() == 0)) { for (stb.a aVar : list) { hwm dl = hxw.this.iYj.dl(str2, aVar.groupId); if (dl == null) { if (1 == aVar.usU) { hxw.this.iYj.a(new hwm().a(aVar, 0, str2)); } } else if (aVar.usU == 0 && dl.iVe == 0) { hxw.this.iYj.a(new hwm().a(aVar, 0, str2)); Intent intent = new Intent("cn.wps.moffice.note.noteservice.broadcast.GROUP_DELETED"); intent.setPackage(NoteApp.fdj().getPackageName()); intent.putExtra("cn.wps.note.noteservice.GROUP_ID", aVar.groupId); hxw.this.mContext.sendBroadcast(intent); } else if (dl.iVf == 0) { hxw.this.iYj.a(new hwm().a(aVar, 0, str2)); } } Intent intent2 = new Intent("cn.wps.moffice.note.noteservice.broadcast.GROUP_SYNC_SUCCESS"); intent2.setPackage(NoteApp.fdj().getPackageName()); hxw.this.mContext.sendBroadcast(intent2); } hxw.this.qb(false); sng.agF(sng.a.uin).a(snf.LAST_SYNC_GROUP_TIME, stb2.cwd); hxw.this.a((hxw) hxu, (hxu) null, (Object) 0); } }); } @Override // defpackage.hxt public final void e(String str, hxu hxu) throws RemoteException { List<hwn> Ci; synchronized (this.iYf) { Ci = this.iYg.Ci(str); } a(hxu, Ci, 0); } @Override // defpackage.hxt public final void e(String str, String str2, hxu hxu) throws RemoteException { List<hwn> dq; synchronized (this.iYf) { dq = this.iYg.dq(str, str2); } a(hxu, dq, 0); } @Override // defpackage.hxt public final void e(String str, String str2, String str3, String str4, String str5) { Cz(str); f(str, str2, str3, str4, str5); } @Override // defpackage.hxt public final void f(String str, hxu hxu) throws RemoteException { List<hwn> Cj; synchronized (this.iYf) { Cj = this.iYg.Cj(str); } a(hxu, Cj, 0); } @Override // defpackage.hxt public final void f(String str, String str2, hxu hxu) throws RemoteException { hwp dt; synchronized (this.iYf) { dt = this.iYg.dt(str, str2); } a(hxu, dt, dt == null ? -1 : 0); } @Override // defpackage.hxt public final void g(String str, hxu hxu) throws RemoteException { a(hxu, this.iYj.Ce(str), 0); } @Override // defpackage.hxt public final void g(String str, String str2, hxu hxu) throws RemoteException { hwn dr; synchronized (this.iYf) { dr = this.iYg.dr(str, str2); } a(hxu, dr, dr == null ? -1 : 0); } @Override // defpackage.hxt public final void h(String str, hxu hxu) throws RemoteException { a(hxu, this.iYk.Ce(str), 0); } @Override // defpackage.hxt public final void h(String str, String str2, hxu hxu) throws RemoteException { hwr du; synchronized (this.iYf) { du = this.iYg.du(str, str2); } a(hxu, du, du == null ? -1 : 0); } @Override // defpackage.hxt public final void i(String str, hxu hxu) throws RemoteException { List<hwn> a = sno.a(str, new TypeToken<List<hwn>>() { /* class defpackage.hxw.AnonymousClass11 */ }); synchronized (this.iYf) { this.iYg.cH(a); } a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final void i(String str, String str2, hxu hxu) throws RemoteException { hwm dl = this.iYj.dl(str, str2); a(hxu, dl, dl == null ? -1 : 0); } @Override // defpackage.hxt public final void j(String str, hxu hxu) throws RemoteException { this.iYk.a((hwu) sno.instance(str, hwu.class)); a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final void j(String str, String str2, hxu hxu) throws RemoteException { int dA; synchronized (this.iYf) { dA = this.iYg.dA(str, str2); } a(hxu, Integer.valueOf(dA), 0); } @Override // defpackage.hxt public final void k(String str, String str2, hxu hxu) throws RemoteException { a(hxu, Boolean.valueOf(this.iYk.dQ(str, str2)), 0); } @Override // defpackage.hxt public final void l(String str, String str2, hxu hxu) throws RemoteException { hwm hwm = (hwm) sno.instance(str2, hwm.class); hwm.userId = str; hwm.czI = System.currentTimeMillis(); this.iYj.b(hwm); qb(true); a(hxu, hwm, 0); } @Override // defpackage.hxt public final void m(String str, String str2, hxu hxu) throws RemoteException { hwo ds; if (TextUtils.isEmpty(str)) { synchronized (this.iYf) { ds = this.iYg.ds(null, str2); this.iYg.dB(str, str2); this.iYg.dD(str, str2); this.iYg.dE(str, str2); } this.iYl.CG(str2); if (ds != null) { a((String) null, ds); } } else { synchronized (this.iYf) { dX(str, str2); } this.iYl.CG(str2); qb(true); } a(hxu, (Object) null, 0); } @Override // defpackage.hxt public final void n(String str, String str2, hxu hxu) throws RemoteException { if (TextUtils.isEmpty(str)) { this.iYj.dm(str, str2); } else { this.iYj.dn(str, str2); } qb(true); a(hxu, (Object) null, 0); } }